package com.chuanke.ckfamily.service.common;


import com.chuanke.ckfamily.service.common.model.RSAKey;

import java.security.PrivateKey;
import java.security.PublicKey;

/**
 * Created by wangbin on 2017/7/2.
 */
public interface RSAService {

    /**
     * 获取公钥
     *
     * @return
     */
    String getPublicKey();

    /**
     * 公钥加密
     *
     * @param context
     * @return
     */
    String encrypt(String context);

    /**
     * 私钥解密
     *
     * @param cipherData
     * @return
     */
    String decrypt(String cipherData);

    /**
     * 公钥解密
     *
     * @param cipherData
     * @param publicKey
     * @return
     */
	String decryptByPublicKey(String cipherData, PublicKey publicKey);

    /**
     * 私钥加密
     *
     * @param data
     * @param privateKey
     * @return
     */
	String encryptByPrivateKey(String data, PrivateKey privateKey);

	RSAKey getRSAKeyMsg();

}
